//
//  KLHeadView.m
//  kularkDemo
//
//  Created by szblsx2 on 2020/4/21.
//  Copyright © 2020 szblsx. All rights reserved.
//

#import "KLHeadView.h"

@interface KLHeadView ()

@property (nonatomic, weak) UILabel *nameLabel;

@end

@implementation KLHeadView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setupSubviews];
    }
    return self;
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.frame = CGRectMake(0, 0, 60, 60);
    [self setupSubviews];
}

- (void)setupSubviews
{
    self.layer.cornerRadius = self.frame.size.width/2;
    self.layer.masksToBounds = YES;
    self.backgroundColor = [UIColor blueColor];
    
    UILabel *nameLabel = [[UILabel alloc] initWithFrame:self.bounds];
    _nameLabel = nameLabel;
    nameLabel.textAlignment = NSTextAlignmentCenter;
    nameLabel.textColor = [UIColor whiteColor];
    nameLabel.font = [UIFont systemFontOfSize:13];
    
    [self addSubview:nameLabel];
}

- (void)setName:(NSString *)name
{
    _nameLabel.text = name;
}

@end
